<template>
  <div class="common-page f-c">
    <BackPage title="3.0项目流程配置" />
    <div class="search-params f-r a-c j-b">
      <el-form inline label-width="110px">
        <el-form-item label="项目性质：">
          <el-select v-model="searchParams.projectNature" clearable>
            <el-option v-for="item in options1" :key="item.value" :value="item.value" :label="item.name" />
          </el-select>
        </el-form-item>
        <el-form-item label="实施单位：">
          <el-input v-model="searchParams.implementUnit" clearable />
        </el-form-item>
        <el-form-item label="责任单位：">
          <el-input v-model="searchParams.dutyUnit" clearable />
        </el-form-item>

        <el-form-item label="行政管理单位：">
          <el-input v-model="searchParams.administrationUnit" clearable />
        </el-form-item>
        <el-form-item label="关联状态：">
          <el-select v-model="searchParams.relevance" clearable>
            <el-option v-for="item in options3" :key="item.value" :value="item.value" :label="item.name" />
          </el-select>
        </el-form-item>
        <el-form-item label="项目名称：">
          <el-input v-model="searchParams.projectName" clearable />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" round @click="onSearch">筛选</el-button>
          <el-button round @click="onReset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>

    <div class="table-box f-g">
      <el-table
        v-loading="loading"
        height="100%"
        stripe
        :data="tableData"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(255, 255, 255, 0.8)"
        @selection-change="onSelect"
      >
        <el-table-column type="index" width="80px" label="序号" align="center" />
        <el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" align="center" />
        <el-table-column label="操作" fixed="right" width="100px">
          <template slot-scope="scope">
            <el-button type="text" @click="onEdit(scope.row)">流程配置</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="page-box">
      <el-pagination
        background
        :current-page="pageNo"
        :page-sizes="pageSizes"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalSize"
        @size-change="changePageSize"
        @current-change="changePageNo"
      />
    </div>
  </div>
</template>

<script>
import crud from '@/mixins/crud'
import { http_project2 } from '@/api'
export default {
  name: 'Index',
  mixins: [crud],
  data() {
    return {
      request: http_project2,
      searchParams: {
        'projectName': null,
        'projectNature': null,
        'implementUnit': null,
        'dutyUnit': null,
        'administrationUnit': null,
        'progress': null
      },
      options1: [
      ],
      options2: [
        { value: 0, name: '进行中' },
        { value: 1, name: '已完成' },
        { value: 2, name: '未完成' }
      ],
      options3: [
        { value: 0, name: '未关联' },
        { value: 1, name: '已关联' }
      ],
      columns: [
        { prop: 'projectName', label: '项目名称' },
        { prop: 'projectNature', label: '项目性质' },
        { prop: 'ageLimit', label: '建设起止年限' },
        { prop: 'constructContent', label: '建设内容和规模' },
        { prop: 'totalAmount', label: '总投资' },
        { prop: 'planAmount', label: '计划投资' },
        { prop: 'planningBasis', label: '计划形象进度' },
        { prop: 'implementUnit', label: '实施单位' },
        { prop: 'dutyUnit', label: '责任单位' },
        { prop: 'administrationUnit', label: '行政管理单位' }
      ],
      tableData: []
    }
  },
  created() {

  },
  methods: {
    onEdit(item) {
      this.$router.push({
        path: '/project/config-edit',
        query: {
          projectId: item.id
        }
      })
    }
  }
}
</script>

<style scoped lang="scss">
</style>
